import * as constants  from './constants';
import axios  from 'axios';
const getDatailAction =(title,content) => ({
    type:constants.GET_DETAIL_ACTION,
    title,
    content
})


export const getDatailDate = (id) => {
return   (dispatch) => {
  axios.get('/api/detail.json?id='+ id).then((res) => {
    const data = res.data;
     dispatch(getDatailAction(data.data.title,data.data.content));
  }).catch((error) => {
    console.log(error);
  });
}

};
